package com.jian.java.service;

import com.jian.java.entities.Dept;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author Jiange
 * @create 2021-06-01-19:00
 */
@Component
public class DeptFallbackFactory implements FallbackFactory<DeptService> {
    @Override
    public DeptService create(Throwable throwable) {
        return new DeptService() {
            @Override
            public boolean add(Dept dept) {
                return false;
            }

            @Override
            public List<Dept> getAll() {
                return null;
            }

            @Override
            public Dept get(int id) {
                return new Dept(0L,"建哥最帅","没有这个数据库");
            }
        };
    }
}
